package org.jeecg.modules.compilation.service.impl;

import org.jeecg.modules.compilation.dto.CiBusinessCategoryDTO;
import org.jeecg.modules.compilation.service.ICiBusinessCategoryService;
import org.jeecg.modules.compilation.entity.CiBusinessCategory;
import org.jeecg.modules.compilation.mapper.CiBusinessCategoryMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.LinkedList;
import java.util.List;

/**
 * @Description: 业务类型管理
 * @Author: jeecg-boot
 * @Date:   2024-03-15
 * @Version: V1.0
 */
@Service
public class CiBusinessCategoryServiceImpl extends ServiceImpl<CiBusinessCategoryMapper, CiBusinessCategory> implements ICiBusinessCategoryService {

    @Override
    public List<CiBusinessCategoryDTO> queryList() {
        List<CiBusinessCategory> ciBusinessCategoryList = this.lambdaQuery().eq(CiBusinessCategory::getEnableFlag, "1").list();
        List<CiBusinessCategoryDTO> ciBusinessCategoryDTOList = new LinkedList<>();
        for (CiBusinessCategory ciBusinessCategory : ciBusinessCategoryList) {
            CiBusinessCategoryDTO ciBusinessCategoryDTO = new CiBusinessCategoryDTO();
            BeanUtils.copyProperties(ciBusinessCategory,ciBusinessCategoryDTO);
            ciBusinessCategoryDTOList.add(ciBusinessCategoryDTO);
        }
        return ciBusinessCategoryDTOList;
    }
}
